<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
	<base th:href="@{/}">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<!--style start-->
	<th:block th:include ="commHeaderInclude::commHead"></th:block>
	<th:block th:include ="commHeaderInclude::formPageComm"></th:block>
	<!--style end-->
	<title>选择授权书</title>
	<style>
		.select{
		}
	</style>
</head>

<body class="ht">
<th:block th:include="commHeaderInclude::loading"></th:block>
<div class="content-wrapper">
	<form class="searchForm limited" id="searchForm" method="post">
		<div class="card" id="searchModule">
			<div class="card-body">
				<h4 class="card-title">按条件查询授权书</h4>
				<div class="module searchModule">
					<ul class="mb-3">
						<li style="width: 100%;">
							<label>产品名称</label>
							<div><input type="text" /></div>
						</li>
					</ul>
					<div class="searchBtnContainer ml-4" style="top: 0;">
						<input type="hidden" name="token"  th:value="${session.token}">
						<input class="btn btn-primary" type="submit" id="search" value="查询">
						<input class="btn btn-clear" type="reset" id="clearButton" value="清空">
					</div>
				</div>
			</div>
		</div>
	</form>

	<form class="listForm" method="post" id="listForm">
		<input type="hidden" name="token"  th:value="${session.token}">
		<div class="card mb-3 border-top-0">
			<div class="card-body listModule" id="listModule">
				<h4 class="card-title">待选择授权书列表</h4>
				<div class="module">
					<div>
						<table cellpadding="0" cellspacing="0" class="hTable">
							<thead>
							<tr>
								<th>序号</th>
								<th>医保统筹区</th>
								<th>授权书</th>
								<th>授权状态</th>
								<th class="select">选择</th>
							</tr>
							</thead>
							<tbody>
							<tr th:each="li,item:${vo.page.list}">
								<td th:text="${item.index+vo.page.startRow}">序号</td>
								<td th:text="${li.areaName}">授权书</td>
								<td th:text="${li.authNo}">授权书</td>
								<td th:text="${li.authStatusStr}">授权状态</td>
								<td class="select"><a class="btn btn-outline-primary btn-sm selectButton" th:classappend="${li.authStatus!='1' ? 'disabled':''}" th:data-id="${li.id}" th:data-authstatus="${li.authStatus}">选择</a></td>
							</tr>
							</tbody>
						</table>
						<div class="noneRecord" th:if="${vo.page.total==0}">查无记录！</div>
					</div>
					<th:block th:include="commHeaderInclude::pageInfoComm"></th:block>
				</div>
			</div>
		</div>
	</form>
</div>
</body>
<script>
    var page=new ListPage();
    page.init();

    $(".selectButton").on("click",function(event){
        var id=event.currentTarget.dataset.id;
		var authStatus=event.currentTarget.dataset.authstatus;
		console.log(authStatus);
        if(authStatus==null || authStatus=='0'){
            alert("无效的授权书，不可选择");
        }
        if(authStatus==1){
            parent.setAuthById(id);
		}
        if(authStatus==2){
		    alert("无效的授权书，不可选择");
        }
        if(authStatus==3){
            alert("无效的授权书，不可选择");
        }
    })
</script>
</html>